﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ProyectoHCI
{
    public partial class NuevaPartidaGrupal : Plantilla
    {
        protected Login login;
        protected PantallaDocente pantallaDocente;
        protected bool partidaAbierta;
        public NuevaPartidaGrupal(PantallaDocente PD, Login l)
        {
            InitializeComponent();
            login = l;
            partidaAbierta = false;
            base.InitializeComponent();
            pantallaDocente = PD;
            //tableLayoutPanel2.Enabled = false;
            tableLayoutPanel2.Visible = false;
            label8.Visible = false;

        }

        private void NuevaPartidaGrupal_Load(object sender, EventArgs e)
        {

        }

        private void numericUpDown1_ValueChanged(object sender, EventArgs e)
        {

        }

        private void numericUpDown1_Click(object sender, EventArgs e)
        {

        }
        private void Click(object sender, EventArgs e)
        {
            numericUpDown1.Select(0, numericUpDown1.Value.ToString().Length);
        }
        private void ClickNombrePartida(object sender, EventArgs e)
        {
            textBox1.Select(0, textBox1.Text.Length);
            //numericUpDown1.Select(0, numericUpDown1.Value.ToString().Length);
        }

        private void button4_Click(object sender, EventArgs e)
        {
            pantallaDocente.Visible = true;
            this.Visible = false;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            (new CargarPreguntas(this)).Visible = true;
            this.Enabled = false;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            (new AgregarPreguntas(this,login)).Visible = true;
            this.Visible = false;

        }
        private void cerrarSesion(object sender, LinkLabelLinkClickedEventArgs e)
        {//BOTON CERRAR SESION
            login.Visible = true;
            this.Hide();

        }
        private void button5_Click(object sender, EventArgs e)
        {
            (new EstadisticaPartida(pantallaDocente)).Visible = true;
            this.Dispose();
        }
        private void button3_Click(object sender, EventArgs e)
        {
            if (partidaAbierta == true)
            {// Empezando partida
                (new EstadisticaPartida(pantallaDocente)).Visible = true;
                this.Dispose();
            }
            else
            {//Creando partida y abriendola
                //button3.Text = "Iniciar Partida!";
                partidaAbierta = true;
                button3.Visible = false;
                button5.Visible = true;
                label9.Text = "Esperando Jugadores";
                label9.Visible = true;
                label9.Location = new Point((int)label8.Location.X, (int)label8.Location.Y + 160);

                label9.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                label9.Refresh();
                System.Threading.Thread.Sleep(500);
                label9.Text = "Esperando Jugadores .";
                label9.Refresh();
                System.Threading.Thread.Sleep(500);
                label9.Text = "Esperando Jugadores .";
                label9.Refresh();
                System.Threading.Thread.Sleep(500);
                label9.Text = "Esperando Jugadores ..";
                label9.Refresh();
                System.Threading.Thread.Sleep(500);
                label9.Text = "Esperando Jugadores ...";
                label9.Refresh();
                System.Threading.Thread.Sleep(500);
                label9.Visible = false;
                //label8.Visible = true;
               // label8.Text = "Jugadores conectados:";
                //this.label8.Image = ((System.Drawing.Image)(resources.GetObject("label8.Image")));
                //label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                //label8.Location = new Point((int)label8.Location.X, (int)label8.Location.Y - 80);
                partidaAbierta = true;
                tableLayoutPanel1.Enabled = false;
                tableLayoutPanel2.Visible = true;
                label8.Visible = true;
            }
        }
    }
}
